<?php


namespace Littlexiaoshuishui\Upay\Support;


class Support
{
    public static function sendCurl($url, $params)
    {
        $curl = curl_init();
        curl_setopt($curl, CURLOPT_HTTPHEADER, array(
            'Content-Type: application/json',
            'Content-Length: ' . strlen(json_encode($params)),
        ));
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
        if ($params) {
            curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($params));
        }
        $return = curl_exec($curl);
        curl_close($curl);
        return json_decode($return, true);
    }


}